package cn.nebula.music.converter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import cn.nebula.music.dao.SongDAO;
import cn.nebula.music.domain.Song;


@Component
public class StringToSongConverter implements Converter<String,Song>{

	@Autowired
	private SongDAO songDAO;
	
	@Override
	public Song convert(String source) {
		return songDAO.findSongById(Integer.valueOf(Integer.valueOf(source)));
	}

}
